home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / book / Chap06 / MATLIGHT / SHINEEDIT.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-26  |  1.9 KB  |  92 lines

  1. // ShineEdit.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "matlight.h"
  6. #include "ShineEdit.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CShineEdit property page
  16.  
  17. IMPLEMENT_DYNCREATE(CShineEdit, CPropertyPage)
  18.  
  19. CShineEdit::CShineEdit() : CPropertyPage(CShineEdit::IDD)
  20.     {
  21.     //{{AFX_DATA_INIT(CShineEdit)
  22.     m_ShineValue = 0;
  23.     //}}AFX_DATA_INIT
  24.     }
  25.  
  26. CShineEdit::~CShineEdit()
  27. {
  28. }
  29.  
  30. void CShineEdit::DoDataExchange(CDataExchange* pDX)
  31. {
  32.     CPropertyPage::DoDataExchange(pDX);
  33.     //{{AFX_DATA_MAP(CShineEdit)
  34.     DDX_Control(pDX, IDC_SPN_SHINE, m_Spinner);
  35.     DDX_Text(pDX, IDC_EDT_SHINE, m_ShineValue);
  36.     DDV_MinMaxInt(pDX, m_ShineValue, 0, 128);
  37.     //}}AFX_DATA_MAP
  38. }
  39.  
  40.  
  41. BEGIN_MESSAGE_MAP(CShineEdit, CPropertyPage)
  42.     //{{AFX_MSG_MAP(CShineEdit)
  43.     ON_NOTIFY(UDN_DELTAPOS, IDC_SPN_SHINE, OnDeltaposSpnShine)
  44.     ON_EN_CHANGE(IDC_EDT_SHINE, OnChangeEdtShine)
  45.     //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CShineEdit message handlers
  50.  
  51. BOOL CShineEdit::OnInitDialog() 
  52.     {
  53.     char cBuff[16];
  54.     CPropertyPage::OnInitDialog();
  55.     
  56.     m_Spinner.SetRange(0,128);
  57.  
  58.     sprintf(cBuff,"%d",m_ShineValue);
  59.     SetDlgItemText(IDC_EDT_SHINE,cBuff);
  60.     
  61.     return TRUE;  // return TRUE unless you set the focus to a control
  62.                   // EXCEPTION: OCX Property Pages should return FALSE
  63.     }
  64.  
  65. void CShineEdit::OnDeltaposSpnShine(NMHDR* pNMHDR, LRESULT* pResult) 
  66.     {
  67.     NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
  68.     
  69.     *pResult = 0;
  70.     }
  71.  
  72.  
  73. int CShineEdit::GetValue(void)
  74.     {
  75.     return m_ShineValue;
  76.     }
  77.  
  78.  
  79. void CShineEdit::SetValue(int nValue)
  80.     {
  81.     m_ShineValue = nValue;
  82.     }
  83.  
  84. void CShineEdit::OnChangeEdtShine() 
  85.     {
  86.     SetModified(TRUE);
  87.     }
  88.  
  89. void CShineEdit::OnOK()
  90.     {
  91.     m_pParent->PostMessage(WM_UPDATE,0,0);
  92.     }